package com.camundademo.exception;

import lombok.Getter;

/**
 * 业务异常
 */
public class BusinessException extends RuntimeException {

    @Getter
    private final String code;
    @Getter
    private final String errNsg;

    public <E extends Enum<E> & IError> BusinessException(E err) {
        super(err.getErrMsg());
        this.code = err.getCode();
        this.errNsg = err.getErrMsg();
    }

    public <E extends Enum<E> & IError> BusinessException(E err, String errMsg) {
        super(err.getErrMsg() + "@" + errMsg);
        this.code = err.getCode();
        this.errNsg = err.getErrMsg() + "@" + errMsg;
    }

}
